If not, setting redirect www to non www or vice-versa will create duplicity of site. Because google thinks the www and non-www version as different pages.
How to avoid duplicity of site using Google webmaster tool?
To avoid that, we should set the preferred domain (www or non-www).It tells the google webmaster which domain to crawl and index. Otherwise, our site gets penalized in search engines. We should ensure only one URL (www or non-www) is accessible and the other one is redirected.
Sometimes, we may lose valuable search engine traffic due to incorrect configuration. When any search engines come to the site for crawling, it checks for any redirect setup. If not able to follow any redirects, it will think the site has no contents.
If we have specifieddomain as http://www.example.com and we find links to our site is formatted as http://example.com,We will be treated as a http://www.example.com.
Setup you site using google webmaster tool:
Step 1: First, you need to submit your website to google webmaster tool and verify the ownership of your domain with www and without www. Once your ownership was verified, login to your website domain dashboard under the google webmaster tool.
Click on the gear icon is at the top right corner of and then click on the site settings.
here, you can set up your preferred domain. You need to select the www or non-www version of your domain.
Once you set your preferred domain. You have to set up 301 redirection, if you have a WordPress blog, don’t worry about it, By default WordPress will do it.For other users don’t forget to change.
Step 2: Open your file manager of your domain and create a file and name it as .htaccess.Copy and paste the following code and edit your domain name and save the file.
Setup guide: youtube link
If you have preferred www version, use this:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(.*)\.YourDomainName\.com$ [NC]
RewriteRule ^(.*)$ http://www.YourDomainName.com/$1 [R=301,L]
If you have preferred non-www version, use this:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.YourDomainName.com$ [NC]
RewriteRule ^(.*)$ http://YourDomainName.com/$1 [R=301,L]
Post your comments / questions
Recent Article
- How to create custom 404 error page in Django?
- Requested setting INSTALLED_APPS, but settings are not configured. You must either define..
- ValueError:All arrays must be of the same length - Python
- Check hostname requires server hostname - SOLVED
- How to restrict access to the page Access only for logged user in Django
- Migration admin.0001_initial is applied before its dependency admin.0001_initial on database default
- Add or change a related_name argument to the definition for 'auth.User.groups' or 'DriverUser.groups'. -Django ERROR
- Addition of two numbers in django python
Related Article